package com.potato369.cryptNacos.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "crypt_user")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {

    private static final long serialVersionUID = 210010867733935786L;

    @ApiModelProperty(value = "用户id")
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    @JsonProperty(value = "user-id")
    private Long id;

    @ApiModelProperty(value = "姓名")
    @Column(name = "name", nullable = false)
    @JsonProperty(value = "user-name")
    private String name;

    @ApiModelProperty(value = "年龄")
    @Column(name = "age", nullable = false)
    @JsonProperty(value = "user-age")
    private Integer age;

    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_time", nullable = false)
    @JsonProperty(value = "user-create-time")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @Column(name = "update_time", nullable = false)
    @JsonProperty(value = "user-update-time")
    private Date updateTime;

    public User(String name, Integer age) {
        this.name = name;
        this.age = age;
    }
}
